package com.smartstate.admin.biz.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smartstate.admin.biz.entity.bo.UserDictionaryTableEntity;
import org.apache.ibatis.annotations.*;

/**
 * 用户字典表
 *
 * @author HuChenXin
 * @email 844121763@qq
 * @date 2021-08-05 17:16:05
 */
@Mapper
public interface UserDictionaryTableDao extends BaseMapper<UserDictionaryTableEntity> {
    @Insert("INSERT INTO `user_dictionary_table`  ( `id`,`key`, `value`, `user_id`, `enterprise_id`, `status`, `create_time`, `create_by`, `update_time`, `update_by` )" +
            "  VALUES   ( #{id}, #{key}, #{value}, #{userId}, #{enterpriseId}, #{status}, #{createTime}, #{createBy}, #{updateTime}, #{updateBy} )")
    boolean add(UserDictionaryTableEntity userDictionaryTable);

    @Select("select * from `user_dictionary_table` where `key`=#{key} and `user_id`=#{userId}")
    UserDictionaryTableEntity getByUserIdAndKey(@Param("key") String key, @Param("userId") String userId);

    @Update("update `user_dictionary_table` set `key`=#{key},`value`=#{value},`update_time`=#{updateTime}, `update_by`=#{updateBy} where `id`=#{id}")
    boolean updateByEntity(UserDictionaryTableEntity userDictionaryTable);
}
